package com.kang;

import com.kang.bean.bot.*;
import com.kang.vo.CityVo;
import com.kang.vo.PopulationVo;

import java.util.List;
import java.util.Map;

/**
 * @program: service
 * @description: 机器人发送语句类
 * @author: K.faWu
 * @create: 2022-06-09 15:57
 **/

public class MsgResult {
    /**
     * 使用手册
     */
    public static final String HELP = "《城邦争霸》 v0.12\n" +
            "在这片土壤肥沃、资源丰富的大地上建立起属于你的城邦，不断的壮大自己，蚕食领土，最终成为统治一方的最强领主！\n" +
            "命令介绍：\n" +
            "【建城】：开始城邦争霸的第一步，建立一座城池。\n" +
            "【查看城邦】：查看你所统领的城邦信息\n" +
            "【城池（x，y）】：查看对应城池的信息，注：符号为中文符号" +
            "【城池（x，y）招募士兵/伐木工/矿工num】：将农民转变为各个工种，指令示例：'城池（5，3）招募士兵10'\n" +
            "【城池（x，y）遣散士兵/伐木工/矿工num】：将工种转变为农民，指令示例：'城池（5，3）遣散士兵10'\n" +
            "【城池（x，y）增加平民num】：每增加1平民需要消耗2粮食\n" +
            "【探索地图】：来占领更多的领土吧！\n" +
            "【更新公告】：获取更新内容\n" +
            "后续功能开发中~";

    public static final String NOTICE = "尊敬的领主！\n" +
            "本次是一次较大的更新，更新内容有以下几点:\n" +
            "1.将城邦人口集中分配改为每个城池独立操作，大大增加了可操作性。\n" +
            "2.初始化的地图中每个区域都会随机带有一些士兵与平民，打败这些士兵，才能占领该区域。\n" +
            "3.遣散士兵已经工种将需要付出遣散费。\n" +
            "4.下调了初始仓库容量以及每块区域的仓库上限。";

    /**
     * 当前还没有开始游戏
     */
    public static final String NOT_CITY = "您未建立城邦，请先使用【建城】命令建立城邦！";

    /**
     * 区域所有权
     */
    public static final String NOT_HAVE_WAR_MAP ="该区域不属于您，无权操作！";

    /**
     * 错误指令
     */
    public static final String ERROR = "指令错误！";
    /**
     * 建立城邦
     */
    public static String initCity(String accountNickname){
        return "恭喜"+ accountNickname+"领主！\n " +
                "成功建立一座城池!";
    }

    /**
     * 重复建立城邦提醒
     */
    public static String repeatInitCity(String accountNickname){
        return accountNickname+"领主，您已经建立城邦，请勿重复建立!";
    }

    /**
     * 未表明数量，用于招募/遣散/增加 士兵、人口、伐木工、矿工
     */
    public static String notNum(String accountNickname){
        return accountNickname+"领主，您未表明操作数量！";
    }

    /**
     * 人口不足，用于招募士兵、人口、伐木工、矿工
     */
    public static String proNotNum(String accountNickname, Long proNum){
        return accountNickname+"领主,\n" +
                "您当前区域可用平民数量："+proNum+"\n" +
                "平民不足，无法招募！";
    }

    /**
     * 招募成功，用于招募士兵、人口、伐木工、矿工
     */
    public static String recruitSuccess(String accountNickname, String type, Integer num, CityVo cityVo, Map<String, Integer> map, WarMap warMap){
        FoodStore foodStore = cityVo.getFoodStore();
        WoodStore woodStore = cityVo.getWoodStore();
        MineStore mineStore = cityVo.getMineStore();
        return accountNickname + "领主,\n" +
                "招募成功！\n" +
                "区域(" + warMap.getX() + "," + warMap.getY() + ")" + type + "数量：" + num + "\n" +
                "可用平民：" + warMap.getFarmerNum() + "\n" +
                "消耗粮食：" + map.get(Constants.FOOD) + "/剩余：" + foodStore.getNum() + "\n" +
                "消耗木材：" + map.get(Constants.WOOD) + "/剩余：" + woodStore.getNum() + "\n" +
                "消耗矿石：" + map.get(Constants.MINE) + "/剩余：" + mineStore.getNum();
    }

    /**
     * 资源不够用
     */
    public static String notResources(String accountNickName, String type){
        return accountNickName + "领主，\n" +
                "资源不足！\n" +
                type+ "失败！";
    }

    /**
     * 基础信息展示
     */
    public static String getCityInfo(String accountNickname, CityVo cityVo){
        PopulationVo porInfo = cityVo.getPorInfo();
        FoodStore foodStore = cityVo.getFoodStore();
        WoodStore woodStore = cityVo.getWoodStore();
        MineStore mineStore = cityVo.getMineStore();
        WarMap warMap = cityVo.getWarMap();
        List<WarMap> warMapList = cityVo.getWarMapList();
        StringBuilder msg = new StringBuilder();
        for(int i = 0; i<warMapList.size(); i++){
            WarMap warMap1 = warMapList.get(i);
            msg.append(i + 1).append(".(").append(warMap1.getX()).append(",").append(warMap1.getY()).append(") ");
        }
        return accountNickname+"领主，\n"+
                "您所拥有的城池数量："+ cityVo.getNum() + "\n" +
                "主城所在位置：("+ warMap.getX() + "," + warMap.getY() + ")\n" +
                "粮食：" + foodStore.getNum() + "/" + foodStore.getMax() + "\n" +
                "木材：" + woodStore.getNum() + "/" + woodStore.getMax() + "\n" +
                "矿石：" + mineStore.getNum() + "/" + mineStore.getMax() + "\n" +
                "总人口：" + porInfo.getSum() + "/"+ porInfo.getMax() + "\n" +
                "军队：" + porInfo.getSoldierNum() + "/"+ porInfo.getSoldierMax() + "\n" +
                "伐木工："+ porInfo.getWoodcutterNum() + "/"+ porInfo.getWoodMax() + "\n" +
                "矿工："+ porInfo.getMinerNum() + "/"+ porInfo.getMinerMax() + "\n" +
                "平民："+ porInfo.getProNum() + "\n" +
                "城池位置：" + msg + "\n" +
                "我们的城邦在您的带领下，繁荣昌盛！";
    }

    /**
     * 遣散人口不足
     */
    public static String disband(String accountNickname, String proType, Integer num){
        return accountNickname  +"领主,\n" +
                "当前可遣散" + proType + "：" + num + "\n" +
                "可遣散" + proType + "不足！";
    }

    /**
     * 未表明遣散数量，用于遣散士兵、人口、伐木工、矿工
     */
    public static String disbandNotNum(String accountNickname){
        return accountNickname+"领主，您未表明遣散数量！";
    }

    /**
     * 遣散成功，用于招募士兵、人口、伐木工、矿工
     */
    public static String disbandSuccess(String accountNickname, String proType, Integer num, WarMap warMap){
        return accountNickname+"领主,\n" +
                "遣散成功！\n" +
                "城池("+ warMap.getX()+","+ warMap.getY() +")" + proType+"数量："+num +"\n" +
                "可用平民："+ warMap.getFarmerNum();
    }

    /**
     * 增加人口
     */
    public static String addProSuccess(String accountNickname, WarMap warMap, FoodStore foodStore, Long footOutNum) {
        return accountNickname + "领主，\n" +
                "城池("+ warMap.getX() + "," + warMap.getY() +")平民增加成功！ \n" +
                "消耗粮食：" + footOutNum + "\n" +
                "城池人口总数：" + warMap.getSum() + "/" + warMap.getMax() + "\n" +
                "当前平民数量：" + warMap.getFarmerNum() + "\n" +
                "当前粮食：" + foodStore.getNum() + "/" + foodStore.getMax();
    }

    /**
     * 侦察区域信息
     */
    public static String warMapInfo(String nickname, WarMap warMap, Integer warMapIndex, Map<String, String> typeMap){
        return nickname + "领主，区域" + ((warMapIndex + 1==0)?"":(warMapIndex + 1)) + "信息如下： \n" +
                "地形为" + typeMap.get(warMap.getType()) +"\n" +
                "所在位置("+warMap.getX()+","+ warMap.getY() +")\n" +

                "军队：" + warMap.getSoldierNum() + "/" + warMap.getSoldierMax() + "\n" +
                "矿工：" + warMap.getMinerNum() + "/" + warMap.getMinerMax() + "\n" +
                "伐木工：" + warMap.getWoodNum() + "/" + warMap.getWoodMax() + "\n" +
                "平民：" + warMap.getFarmerNum() + "/" + warMap.getProMax() + "\n" +
                "人口总数：" + warMap.getSum() + "/" + warMap.getMax();
    }
}
